package com.westos.aopv1.springaop;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;

public class IOperatorBeforeAdvice implements MethodBeforeAdvice,AfterReturningAdvice {

    public void before(Method method, Object[] args, Object target) throws Throwable {
        System.out.println("spring AOP的Before Advice，在代码执行前执行");
        System.out.println("操作日志：");
        System.out.println("执行的类："+method.getDeclaringClass().getName());
        System.out.println("参数1："+args[0]+",参数2："+args[1]);
    }

    public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
        System.out.println("在代码执行后执行的代码。");
    }
}